package com.mit.wx.wx.dto;

import com.mit.wx.util.xml.CDataConverter;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 2018/10/13 Create by 郭文梁
 * TargetVoiceMessage
 * 回复语音消息
 *
 * @author 郭文梁
 * @date 2018/10/13
 */
@EqualsAndHashCode(callSuper = true)
@Data
@XStreamAlias("xml")
public class TargetVoiceMessage extends TargetMessage {
    public TargetVoiceMessage() {
        this.setMsgType(WxMessages.TYPE_VOICE);
    }

    @XStreamAlias("Voice")
    private Voice voice;

    public void mediaId(String mediaId) {
        Voice voice = new Voice();
        voice.setMediaId(mediaId);
        this.setVoice(voice);
    }
}

@Data
class Voice {
    @XStreamConverter(CDataConverter.class)
    @XStreamAlias("MediaId")
    private String mediaId;
}
